/*
 * RadioButton.java  0.4.0 / Oct 26, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing;

import com.cute4j.swing.events.FocusEvent;
import com.cute4j.swing.events.SwingEvent;

/**
 * Radio Button Component.
 *
 * @cute4j.native
 *    generate="header"
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class RadioButton extends ToggleButton {

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new RadioButton object.
   */
  public RadioButton() {
    super();
  }

  /**
   * Constructs new RadioButton object.
   *
   * @param action the action
   */
  public RadioButton(Action action) {
    super(action);
  }

  /**
   * Constructs new RadioButton object.
   *
   * @param text the button text
   */
  public RadioButton(String text) {
    super(text);
  }

  /**
   * Constructs new RadioButton object.
   *
   * @param icon the icon
   */
  public RadioButton(Icon icon) {
    super(icon);
  }

  /**
   * Constructs new RadioButton object.
   *
   * @param text the button text
   * @param icon the icon
   */
  public RadioButton(String text, Icon icon) {
    super(text, icon);
  }

// Overridden Methods. ---------------------------------------------------------

  void _focusGained() {
    focused = true;
    if (selectableGroup != null) {
      setSelected(true);
    }
    if (eventEnabled(SwingEvent.FOCUS_EVENT_MASK)) {
      processFocusEvent(new FocusEvent(this, FocusEvent.FOCUS_GAINED));
    }
  }

// Package-Private Native Methods. ---------------------------------------------

  native long _create();

}
